package entity

import (
	"time"

	"shqsoft.cn/pasnj/base"

	"github.com/jinzhu/gorm"
)

//可保费用
type BaseJhcwKbfyDr struct {
	ID   int       `gorm:"AUTO_INCREMENT;primary_key;column:ID"`
	DTID time.Time `gorm:"column:DTID";type:date` //导入日期
	EMID int       `gorm:"column:EMID"`           //员工ID
	EMNO string    `gorm:"column:EMNO"`           //工号
	EMNM string    `gorm:"column:EMNM"`           //姓名
	KBFY float64   `gorm:"column:KBFY"`           //可报费用
	DRJG string    `gorm:"column:DRJG"`           //导入结果
}

//TableName 对私贷款认定分户情况
func (BaseJhcwKbfyDr) TableName() string {
	return "T_BASE_JHCW_KBFY_DTIP"
}

//导入后执行分户处理
func JhcwKbfyAfterImport(tx *gorm.DB, params map[string]string) (err error) {
	prams := make([]interface{}, 1)
	prams[0] = params["DTID"]
	tx.Exec("exec UP_BASE_JHCW_KBFY_DTIP ?", prams...)
	return nil
}

func BaseJhcwKbfyDrEF() base.EntityFunc {
	return func() interface{} {
		entity := BaseJhcwKbfyDr{}
		return &entity
	}
}
func BaseJhcwKbfyDrESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []BaseJhcwKbfyDr
		return &entities
	}
}

func init() {
	base.DaoPoolObj.Put("BaseJhcwKbfyDr", base.NewDefaultDao(BaseJhcwKbfyDrEF(), BaseJhcwKbfyDrESF(), nil))
	base.SetAfterCallBack("BaseJhcwKbfyDr", JhcwKbfyAfterImport)
}
